// pages/stock/stock-replenish/stock-replenish.js
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    data:'',
    keyword: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let that = this;
    app.post('/shop/getStockList').then(res=>{
      that.setData({
        data:res
      })
    });
  },
  hddetail:function(e){
    let id = e.currentTarget.dataset.id;
    console.log(e.currentTarget.dataset.id);
    wx.navigateTo({
      url: '../stock-rep-detail/stock-rep-detail?id='+id,
    })
  },
  inputSearch: function (e) {
    let keyword = e.detail.value;
    let that = this;
    app.post('/shop/searchStockList', { keyword: keyword }).then(res => {
      that.setData({
        data: res,
      })
    });
  }
})